home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Surfer: Getting Started
/
Internet Surfer - Getting Started (Wayzata Technology)(7231)(1995).bin
/
pc
/
mac
/
bonus
/
peter_le
/
macbinar
/
displays.p
< prev
next >
Wrap
Text File
|
1992-11-23
|
1KB
|
71 lines
unit Displays;
interface
var
display_done, display_total: longInt;
procedure InitDisplay;
procedure FinishDisplay;
procedure UpdateDisplay;
implementation
uses
FixMath;
var
dlg: dialogPtr;
has_colorqd: boolean;
procedure InitDisplay;
var
sysenv: sysEnvRec;
oe: OSErr;
begin
display_done := 0;
display_total := 0;
dlg := GetNewDialog(129, nil, POINTER(-1));
oe := SysEnvirons(1, sysEnv);
has_colorqd := sysenv.hasColorQD;
end;
procedure FinishDisplay;
begin
DisposeDialog(dlg);
end;
procedure UpdateDisplay;
const
HiliteRGBP = $DA0;
type
RGBColorPtr = ^RGBColor;
var
box: rect;
w, uw: integer;
oldfore: RGBColor;
begin
SetPort(dlg);
box := dlg^.portRect;
with box do begin
w := right - left;
if display_total = 0 then
uw := 0
else
uw := FracMul(w, FracDiv(display_done, display_total));
right := left + uw;
if has_colorQD then begin
GetForeColor(oldfore);
RGBForeColor(RGBColorPtr(HiliteRGBP)^);
PaintRect(box);
RGBForeColor(oldfore);
end
else
FillRect(box, gray);
left := right;
right := right + w - uw;
EraseRect(box);
end;
end;
end.